﻿using PizzaMario.Domain.Concrete;

namespace PizzaMario.Domain.Abstract
{
    public abstract class BaseRepository<T, TU> : AbstractBaseRepository<T>, IRepository<T, TU> where T : class
    {
        private IDatabaseFactory DbFactory { get; set; }

        protected BaseRepository(IDatabaseFactory databaseFactory)
            : base(databaseFactory)
        {
            DbFactory = databaseFactory;
        }

        public virtual T GetById(TU id)
        {
            return DbSet.Find(id);
        }

        public virtual Context GetContext()
        {
            return DbFactory.Get();
        }
    }
}